/**
 *
 * jcrt and its source-code is licensed under the LGPL.
 * You may copy, adapt, and redistribute this file for commercial or non-commercial use.
 * When copying, adapting, or redistributing this document in keeping with the guidelines above,
 * you are required to provide proper attribution to obinary.
 * If you reproduce or distribute the document without making any substantive modifications to its content,
 * please use the following attribution line:
 *
 * Copyright 2007 Atjava.com Ltd. (http://www.atjava.com) All rights reserved.
 *
 */
package com.atjava.jcrt;

import java.io.Serializable;
import java.util.List;

import com.atjava.jcrt.core.exception.CoreException;
import com.atjava.jcrt.core.query.ConditionData;
import com.atjava.jcrt.core.query.Query;
import com.atjava.jcrt.core.version.Version;
/**
 * JcrtSession
 * 
 * @author biggie
 * @version $Revision: 1.4 $ $Date: 2008/07/11 07:17:14 $
 */
public interface JcrtSession extends Serializable {

	/**
	 * Save a persistent instance to the Repository with the given repository path
	 * 
	 * @param object a transient instance of a persistent class
	 * @param path repository path
	 * @return the generated identifier
	 * @throws CoreException
	 */
	public Serializable save(Object object,String path) throws CoreException;
	
	/**
	 * Remove a persistent instance from the Repository of the given entity class 
	 * with the given repository path
	 * 
	 * @param theClass a persistent class
	 * @param path repository path
	 * @throws CoreException
	 */
	public void delete(Class theClass, String path) throws CoreException;
	/**
	 * Remove a persistent instance from the Repository with the given repository path
	 * 
	 * @param object a transient instance of a persistent class
	 * @throws CoreException
	 */
	public void delete(Object object) throws CoreException;
	/**
	 * Return the persistent instance of the given entity class with the given repository path,
	 * assuming that the instance exists.
	 *
	 * @param theClass a persistent class
	 * @param path repository path
	 * @return the persistent instance
	 * @throws CoreException
	 */
	public Object load(Class theClass, String path) throws CoreException;
	/**
	 * Return the Version instance of the given entity class with the given repository path,
	 * assuming that the instance exists.
	 *
	 * @param theClass a persistent class
	 * @param path repository path
	 * @return the persistent instance
	 * @throws CoreException
	 */
	public Version getVersion(Class theClass, String path) throws CoreException;
	/**
	 * Return the Query instance of the given entity class with the given repository path,
	 * assuming that the instance exists.
	 *
	 * @param theClass a persistent class
	 * @param path repository path
	 * @param conditionData
	 * @return the persistent instance
	 * @throws CoreException
	 */
	public Query createQuery(Class theClass, String path,ConditionData conditionData) throws CoreException;
	/**
	 * Return the Query instance of the given entity class with the given repository path,
	 * assuming that the instance exists.
	 *
	 * @param theClass a persistent class
	 * @param path repository path
	 * @param conditionData
	 * @return the persistent instance
	 * @throws CoreException
	 */
	public Query createQuery(Class theClass, String path) throws CoreException;
	/**
	 * Return Children Object with the given repository path
	 * @param theClass
	 * @param path
	 * @return
	 * @throws CoreException
	 */
	public List<Object> getChildren(Class theClass,String path) throws CoreException;
}
